//
//  MMDataViewController.m
//  ExhibitForcePrototype
//
//  Created by Dilyana Todorova on 12/5/12.
//  Copyright (c) 2012 Dilyana Todorova. All rights reserved.
//

#import "MMDataViewController.h"
#import "TextDocumentViewController.h"

@interface MMDataViewController ()
@property(nonatomic, weak) IBOutlet UILabel * dataLabel;
@property(nonatomic, weak) IBOutlet UIButton * showPdfDocument;
@end

@implementation MMDataViewController
@synthesize displayPdfDocument = _displayPdfDocument;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        _displayPdfDocument = NO;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void) viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.dataLabel.text = self.dataToDisplay;
    self.showPdfDocument.hidden = !self.displayPdfDocument;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    self.dataLabel = nil;
    self.showPdfDocument = nil;
}

#pragma mark - actions
- (IBAction) showPdfDocument:(UIButton *) button{
    TextDocumentViewController * documentViewer = [[TextDocumentViewController alloc] init];
    documentViewer.fileName = @"Example";
    [self.navigationController pushViewController:documentViewer animated:YES];
}
@end
